package com.yowasa.xiuxian.engine.battle.buff;

import com.yowasa.xiuxian.annoations.Buff;
import com.yowasa.xiuxian.entity.bo.battle.BattleContent;
import com.yowasa.xiuxian.entity.bo.battle.BuffContent;
import com.yowasa.xiuxian.entity.bo.battle.TempUserBattle;
import com.yowasa.xiuxian.entity.bo.battle.UserBattleContent;


@Buff(name = "雷雾",type = 2)
public class LeiWuBuff implements BuffInterface {

    //回合开始时额外结算
    public void beforeBuffAction(UserBattleContent first, UserBattleContent second, BattleContent content) {
        BuffContent buff = first.getBuff().get("雷雾");
        if(buff.getNum() >= 3){
            int v = (int)(first.getBattleInfo().getMp() * 0.15);
            first.getBattleInfo().setCmp(Math.max(first.getBattleInfo().getCmp() - v,0));
            content.getMsgLog().add(first.getUserBO().getName() + "因雷雾失去了"+v+"点mp");
        }

    }

    //防御类buff处理
    public int defendBuffAction(UserBattleContent user, UserBattleContent battleUser, int dmg){
        BuffContent buff = user.getBuff().get("雷雾");
        buff.setNum(Math.min(3,buff.getNum() + 1));
        return dmg;
    }
}
